<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        let demo = {
            dataSource: "积韬选船系统",
            detail: "对处于惩戒期的船舶赋{0}分，进行标识，便于执法人员、码头货主操作人员识别并采取措施。未经过选船机制赋{1}分，需要引起警示",
            score: [100, 20],
        };
        // /\{(\w)\}/g
        let res = demo.detail.replace(/\{(\d)\}/g, function(s, t) {
            console.log(s, t);
            return demo.score[t];
        });
        console.log(res);
    </script>
</body>

</html>